package com.eastfair.home.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 监督项管理
 * </p>
 *
 * @author linan
 * @date 2022-11-29
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "SupervisionItemManagementSupervisionItemEnum", description = "监督项所属 #{ARRANGEMENT:布展展台验收;DISMANTLING:撤展展台验收-枚举")
public enum SupervisionItemManagementSupervisionItemEnum implements BaseEnum {

    /**
     * ARRANGEMENT="布展展台验收"
     */
    ARRANGEMENT("布展展台验收"),
    /**
     * DISMANTLING="撤展展台验收"
     */
    DISMANTLING("撤展展台验收"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static SupervisionItemManagementSupervisionItemEnum match(String val, SupervisionItemManagementSupervisionItemEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static SupervisionItemManagementSupervisionItemEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(SupervisionItemManagementSupervisionItemEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "ARRANGEMENT,DISMANTLING", example = "ARRANGEMENT")
    public String getCode() {
        return this.name();
    }

}
